﻿using UnityEngine;

namespace AI.Graph {


    public static class Math {

        /// <summary>
        /// Returns the current value between min and max between [0, 1]
        /// </summary>
        /// <param name="current">The current value.</param>
        /// <param name="min">The min value.</param>
        /// <param name="max">The max value.</param>
        /// <returns>Returns a value between [0, 1] depending on min and max.</returns>
        public static float Clamp01 (float current, float min, float max) {
            if (current <= min) {
                return 0;
            }

            if (current >= max) {
                return 1;
            }

            return Mathf.Clamp01 ((current - min) / (max - min));
        }

    }


}